#include<bits/stdc++.h>
using namespace std;
#define ll long long
int c,t;
int n,m;
vector<int> u,v;
void solve(){
	cin>>n>>m;
	u.resize(m+10);
	v.resize(m+10);
	for(int i=1;i<=m;i++){
		cin>>u[i]>>v[i];
	}
	cout<<2*n-2<<" "<<0<<'\n';
}
int main(){
	freopen("oi.in","r",stdin);
	freopen("oi.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	cin>>c>>t;
	while(t--){
		solve();
	}
	return 0;
}
